#ifndef _OKNOGLOWNE_H
#define	_OKNOGLOWNE_H

#include <boost\asio.hpp>
#include "Form1.h"

#include "wyjatki.h"
#include "symulator.h"
#include "obserwator.h"
#include "obiektobserwowalny.h"
#include <algorithm>
#include "autoryzowany.h"


#include "serwer.hpp"



namespace SymulacjaGUI {

   using namespace System;
   using namespace System::Collections;
   using namespace System::ComponentModel;
   using namespace System::Data;
   using namespace System::Drawing;
   using namespace System::Threading;
   using namespace System::Windows::Forms;

   using namespace ZedGraph;

   
   public ref class OknoGlowne : public Form1, public Obserwator {
      public:
      OknoGlowne();
      virtual void obserwuj(ObiektObserwowalny^);
      virtual void aktualizuj(int);
      System::Void buttonSamonastrajanie_Click(System::Object^, System::EventArgs^); 
      System::Void trackBarProbkowanie_Scroll(System::Object^, System::EventArgs^);
      System::Void numericUpDownProbkowanie_ValueChanged(System::Object^, System::EventArgs^);
      System::Void buttonReset_Click(System::Object^, System::EventArgs^);

      System::Void buttonStop_Click(System::Object^, System::EventArgs^);
	  System::Void Okno_Load(System::Object^, System::EventArgs^);

      System::Void buttonOkObiekt_Click(System::Object^ , System::EventArgs^);
      System::Void buttonOkRegulator_Click(System::Object^ , System::EventArgs^);
      System::Void buttonOkWartZad_Click(System::Object^ , System::EventArgs^);
      System::Void dodajMapeDoDataGrid(const std::map<std::string,std::string>&, System::Windows::Forms::DataGridView^);
      System::Void dodajMapeDoComboBox(cliext::map<System::String^,int>, System::Windows::Forms::ComboBox^);
      System::Void dodajWektorDoListBox(cliext::vector<System::String^>, System::Windows::Forms::ListBox^);

      System::Void listBoxWartZad_SelectedIndexChanged(System::Object^, System::EventArgs^);

      System::Void usunDyskretne();
      System::Void wczytajKonfiguracje();
      System::Void buttonWczytaj_Click(System::Object^ , System::EventArgs^); 
      System::Void buttonZapisz_Click(System::Object^ , System::EventArgs^);
      System::Void Reset();
      /*      std::string ToStdString(System::String^);
	      System::String^ ToSysString(std::string);*/
      System::Void dodajPktWykresu (double x, double y1, double y2, double y3 );
      System::Void Zamknij();
      System::Void buttonZamknij_Click(System::Object^, System::EventArgs^);
      System::Void buttonStart_Click(System::Object^, System::EventArgs^);
      System::Void inicjalizacja();
      System::Void dodajPktWykresu(cliext::vector<double>);
      std::map<std::string,std::string> dataGridDoMapy(System::String^, System::Windows::Forms::DataGridView^);
      System::Void buttonZmienParamGeneratora_Click(System::Object^, System::EventArgs^);
      System::Void buttonZmienParamRegulatora_Click(System::Object^, System::EventArgs^);
	  void aktualizujWGlownymWatku(int);
   

      std::string ToStdString(System::String^ source) {
	 std::string result;
	 int len = source->Length;
	 for (int i=0; i<len; i++)
	    result += (char)source[i];
	 return result;
      }
      
      System::String^ ToSysString(std::string source) {
	 System::String^ result;
	 int len = (int)source.length();
	 for (int i=0; i<len; i++)
	    result += (wchar_t)source[i];
	 return result;
      }

		
      private:
      Symulator^ symulator;      
	Autoryzowany^ fingerprint;
      delegate System::Void dodajPktWykresu_d (double x, double y1, double y2, double y3 );
      delegate System::Void aktywujPrzyciskSamonastrajanie_d (bool aktywuj);
	  delegate System::Void aktualizujStan_d(int x);
	
	  //boost::asio::io_service *io;
	  Serwer^ serwer;
	  int loaded;

	 
   };
	
}
#endif	/* _OKNOGLOWNE_H */
